def fac(n):
    if n == 1:
        return 1
    else:
        return n * fac(n-1)     # 调用自己


print(fac(5))   # 5! = 5*4*3*2*1

